package com.gshrms.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gshrms.system.domain.SysExport;
import com.gshrms.system.mapper.SysExportMapper;
import com.gshrms.system.service.ISysExportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 导出配置表 服务实现类
 * </p>
 *
 * @author guolei
 * @since 2025-03-25
 */
@Service
public class SysExportServiceImpl extends ServiceImpl<SysExportMapper, SysExport> implements ISysExportService {

    @Autowired
    SysExportMapper sysExportMapper;

    //新增导出配置sql
    /*insert into sys_export (table_name,title_id,title_name)
    select table_name,COLUMN_name,column_comment from information_schema.`COLUMNS`
    where  TABLE_SCHEMA='gshrms' and table_name='recruitment_applicants' order by ORDINAL_POSITION*/


    //查询导出字段
    public List<SysExport> queryList(String tableName,int checkStatus) {
        QueryWrapper<SysExport> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("table_name", tableName);
        queryWrapper.eq("check_status", checkStatus);
        return this.list(queryWrapper);
    }
    //保存已选项
    public boolean saveChecked(List<SysExport> sysExportList) {
        return this.updateBatchById(sysExportList);
    }
}
